<template>
  <div class="basicAdd">
    <el-form label-width="100px" :model="activities">
      <el-form-item label="名称">
        <el-input v-model="activities.bvalue" clearable placeholder="请填写名称"></el-input>
      </el-form-item>
      <el-form-item label="内容">
        <el-input v-model="activities.bname" clearable placeholder="请填写内容"></el-input>
      </el-form-item>
      <el-form-item label="备注">
        <el-input 
          type="textarea"
          :autosize="{ minRows: 1, maxRows: 5}" 
          v-model="activities.bremarks" 
          clearable 
          placeholder="请填写备注"
          ></el-input>
      </el-form-item>
      <el-button type="success" plain size="mini" @click="addData()">确认添加</el-button>
      <el-button type="warning" plain size="mini" @click="resetData()">重置</el-button>
    </el-form>
  </div>
</template>

<script>
import basic from "@/model/basic";

export default {
  name: "basicAdd",
  components: {},
  data() {
    return {
      activities: {
      },
    };
  },
  async mounted() {
  },
  methods: {
    async addData(){
      this.$confirm('此操作将新增该记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let res = basic.addData({
            data:this.activities
          });
          this.$message({
            type: 'success',
            message: '新增成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消新增'
          });          
        });
    },
    resetData(){
      this.activities = {};
    }
  },
};
</script>

